﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using AnesSystem.ViewModels;

namespace AnesSystem
{
    /// <summary>
    /// FullWindow.xaml 的交互逻辑
    /// </summary>
    public partial class FullWindow : Window
    {

        #region Variables

        private FrameworkElement _content;

        private static FullWindow _instance;

        #endregion

        #region Constructor

        public FullWindow()
        {
            InitializeComponent();
        }

        #endregion

        #region Properties

        public FrameworkElement CusContent
        {
            set
            {
                _content = value;
                _grid.Content = null;
                _grid.Content = value;
            }
        }

        public static FullWindow Instance
        {
            get
            {
                if (_instance == null)
                {
                    _instance = new FullWindow();
                }
                return _instance;
            }
        }

        #endregion

        #region 依赖属性

        #endregion

        #region Event

        #endregion

        #region Private Methods

        private void CloseWin()
        {
            DataManager.Instance.RightContentCtrlViewModel.TableContent = null;
            DataManager.Instance.RightContentCtrlViewModel.TableContent = _content;
            Visibility = Visibility.Collapsed;
        }

        #endregion

        #region Public/Protected Methods

        #endregion

        #region EventHandlers
        private void Window_PreviewKeyUp(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Escape)
            {
                CloseWin();
            }
        }

        private void TextBlock_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            CloseWin();
        }

        #endregion


    }
}
